@layout("home.main")
@section('content')
<div class="main-wrap">
    <div class="main">
        <div class="main-content">
            <div class="title">
                <div class="float-left fs14">
                    最新文章
                </div>    
            </div>

        <div class="main-box home-box-list">
        @if ($archives->results)
           @foreach ($archives->results as $archive)
            <div class="post-list">
                <div class="item-avatar">
                   <a href="{{ $archive->id }}"><img src="{{ $archive->user->userinfo->avatar }}" alt="{{ $archive->title }}" /></a>
                </div>
                <div class="item-content">
                    <h1>{{ HTML::link("archive/".$archive->id,$archive->title) }}</h1>
                    <span class="item-date"> 
                    {{ HTML::link($archive->categorie_id,$archive->categorie->title) }} • {{ $archive->user->uname }}  •  
                    @if ($archive->comment()->count()>0)
                      {{ Helper::gettime($archive->updated_at) }} •  最后回复来自 {{ $archive->reply($archive->comment_id)->uname }}
                    @else
                        {{ Helper::gettime($archive->created_at) }}
                    @endif
                    </span>
                </div>
                <div class="item-count">
                    {{ HTML::link('#reply'.$archive->id,$archive->comment()->count()) }}
                </div>    
            </div>
            @endforeach
        @else
            <p>&nbsp;&nbsp;&nbsp;暂无文章内容</p>
        @endif
        </div>

        {{ $archives->links() }}
        <div class="title">热门分类</div>
        <div class="main-box main-box-node">
        <span class="btn">
            @foreach ($categories as $cate)
                {{ HTML::link($cate->id, $cate->title) }}
            @endforeach
        </span>
        </div>
    </div>
    <!-- main-content end -->
        <div class="main-sider">
            @include("home.slidebar")           
            <div class="sider-box">
                <div class="sider-box-title">链接</div>
                    <div class="sider-box-content">
                    <div class="btn">
                        @foreach ($links as $link)
                            {{ HTML::link($link->url, $link->title) }}
                        @endforeach
                    </div>
                </div>
            </div>
            <div class="sider-box">
                <div class="sider-box-title">站点运行信息</div>
                <div class="sider-box-content">
                    <ul>
                        <li>会员: {{ Helper::e(User::count(),0) }}</li>
                        <li>分类: {{ Helper::e(Categorie::count(),0) }}</li>
                        <li>帖子: {{ Helper::e(Archive::count(),0) }}</li>
                        <li>回复: {{ Helper::e(Comment::count(),0) }}</li>
                    </ul>
                </div>
            </div>       
        </div>
    <!-- main-sider end -->
    </div>
<!-- main end -->
</div>
@endsection
